package com.coffeeloversupportlibrary.core.aliyun.upload;

import androidx.appcompat.app.AppCompatActivity;

import android.os.Bundle;
import android.util.Log;
import android.view.View;
import android.widget.TextView;

import com.alibaba.sdk.android.oss.OSSClient;
import com.alibaba.sdk.android.oss.common.auth.OSSCredentialProvider;
import com.alibaba.sdk.android.oss.common.auth.OSSPlainTextAKSKCredentialProvider;
import com.coffeeloversupportlibrary.R;
import com.coffeeloversupportlibrary.coffeelover.CoffeeLoverApplication;

import java.io.File;

///storage/emulated/0/AlbumBuilder7295040578613768105.png
public class UpLoadActivity extends AppCompatActivity {
    TextView upload;
    private OSSClient client;
    private static final String ENDPOINT = "oss-cn-beijing.aliyuncs.com";

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_up_load);
        OSSCredentialProvider credentialProvider =
                new OSSPlainTextAKSKCredentialProvider("LTAI5tNgkcpfK7wNL7MXgkvG" ,
                        "iocrZUFJv2Nq7wbhvFvJ6WgusRAcSB");
        client=new OSSClient(getApplicationContext(), ENDPOINT, credentialProvider);
        upload=findViewById(R.id.upload);
        upload.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                File file=new File("/storage/emulated/0/AlbumBuilder7295040578613768105.png");
                Log.e("PATH",file.getAbsolutePath()+"   "+file.getName());
            }
        });
    }
}